<template>
  <div>
    <el-tree
      :data="treeData"
      ref="elTree"
      show-checkbox
      node-key="id"
      :props="defaultProps">
    </el-tree>
    <el-button @click="getCheckedKeys">确定</el-button>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        defaultProps: {
          children: 'children',
          label: 'label'
        },
        treeData: []
      };
    },
    mounted(){
      this.treeData = this.$mock.treeData.data
    },
    methods: {
      getCheckedKeys(){
        console.log(this.$refs.elTree.getCheckedKeys());
      }
    }
  };
</script>

<style  lang="less" scoped>
  ::v-deep .el-tree-node.is-expanded>.el-tree-node__children {
    display: flex !important;
  }
</style>